const { default: axios } = require("axios");
const { dewuHeaders } = require("../../tools");
const sign = require("../../tools/sign");

/**
 * Dewu-API根据spuId获取产品详情
 * @param {import("koa").Context} ctx  - 路由上下文
 *  */
module.exports = async(ctx) => {
    let { spuId } = ctx.request.query;
    const signId = sign({
        spuId: spuId,
        productSourceName: '',
        propertyValueId: '0',
    })
    let result = await axios.post(`https://app.poizon.com/api/v1/h5/index/fire/flow/product/detail`, {
        sign: signId,
        spuId: spuId,
        productSourceName: '',
        propertyValueId: '0',
    }, {
        headers: dewuHeaders()
    });
    ctx.body = result.data
}